/*
 * Copyright (c) 2016, FPX and/or its affiliates. All rights reserved.
 * Use, Copy is subject to authorized license.
 */
package com.fpx.open.platform.domain.prealert;

import org.apache.commons.lang3.StringUtils;

/**
 * 
 * @author shiw
 * @date 2016年10月24日
 */
public enum OrderStatusEnum {
	
	PREALERT("P"),
	PICKUP_SUCCESS("B"),
	PICKUP_FAILURE("I"),
	SIGN_SUCCESS("F"),
	RECIVE_SUCCESS("V"),
	CLOSED("X"),
	IN_WAREHOUSE_FAILURE("N");
	
	private String code;
	
	private OrderStatusEnum(String code){
		this.code = code;
	}
	
	public static boolean isCanCancel(String code){
//		if (StringUtils.equals(PREALERT.code, code) || StringUtils.equals(PICKUP_SUCCESS.code, code) || StringUtils.equals(RECIVE_SUCCESS.code, code)
//				|| StringUtils.equals(PICKUP_FAILURE.code, code) || StringUtils.equals(SIGN_SUCCESS.code, code)
//				|| StringUtils.equals(IN_WAREHOUSE_FAILURE.code, code)) {
//			return true;
//		}
		if (StringUtils.equals(PREALERT.code, code) || StringUtils.equals(PICKUP_FAILURE.code, code) 
				|| StringUtils.equals(IN_WAREHOUSE_FAILURE.code, code)) {
			return true;
		}
		return false;
	}
	
	//只有签入失败 和 预报状态的能够被关闭
	public static boolean isCanClose(String code){
		if (StringUtils.equals(PREALERT.code, code) || StringUtils.equals(PICKUP_FAILURE.code, code)) {
			return true;
		}
		return false;
	}

	/**
	 * @return the code
	 */
	public String getCode() {
		return code;
	}

	/**
	 * @param code the code to set
	 */
	public void setCode(String code) {
		this.code = code;
	}
}
